package com.ysw.jdbc;

public class Main {
    public static void main(String[] args) {
//        int i=maxPower("cc");
        String b[]=new String[5];
        int a[]=new int[]{10,3,8,9,4};
        b=findRelativeRanks(a);
        System.out.println(b);
    }
    public static String[] findRelativeRanks(int[] score) {
        int n=score.length;
        int a[][]=new int[n][2];
        String b[]=new String[n];
        for(int i=0;i<n;i++){
            a[i][0]=score[i];
            a[i][1]=i;
        }
        for(int j=0;j<n;n--){
            for(int k=0;k<n-1;k++){
                 if(a[k][0]>a[k+1][0]){
                    int lj1=a[k][0],lj2=a[k][1];
                    a[k][0]=a[k+1][0];
                    a[k+1][0]=lj1;
                    a[k][1]=a[k+1][1];
                    a[k+1][1]=lj2;
                }
            }
        }
        for(int l=0;l<score.length;l++){
            if(l+1==score.length){
                b[a[l][1]]="Gold Medal";
                continue;
            }
            if(l+2==score.length){
                b[a[l][1]]="Silver Medal";
            }
            if(l+3==score.length){
                b[a[l][1]]="Bronze Medal";
            }
            b[a[l][1]]=String.valueOf(score.length-l);
        }
        return b;
    }
}
